#ifndef EEPROM_HPP
#define EEPROM_HPP

class EEPROM {
public:
    struct Info {
        unsigned int capacity;
    };
public:
    virtual bool open(void) = 0;
    virtual bool close(void) = 0;
    virtual int read(void *buff,unsigned int address,unsigned int count) = 0;
    virtual int write(void *buff,unsigned int address,unsigned int count) = 0;
    virtual Info getInfo(void) = 0;
};

class M24C64 : public EEPROM {
public:
    class Portable {
    public:
        virtual void busInit(void) = 0;
        virtual unsigned char readByte(unsigned int address) = 0;
        virtual void writeByte(unsigned int address,unsigned char byte) = 0;
    };
public:
    M24C64(Portable *portable);
    virtual bool open(void);
    virtual bool close(void);
    virtual int read(void *buff,unsigned int address,unsigned int count);
    virtual int write(void *buff,unsigned int address,unsigned int count);
    virtual Info getInfo(void);
protected:
    Portable *portable;
};

#endif
